﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.ProjectAnnouncement
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.ProjectAnnouncement;

    class ProjectAnnouncement_Map : ClassMapping<ProjectAnnouncement>
    {
        public ProjectAnnouncement_Map()
        {
            //映射ID
            Id(x => x.ID, map =>
            {
                map.Length(40);
                map.Column("nr_id");
            });

            Property(x => x.IsValid, map =>
            {
                map.Column("is_valid");
            });

            Property(x => x.CreateDate, map =>
            {
                map.Column("create_date");
            });

            Property(x => x.AnnounceDate, map =>
            {
                map.Length(50);
                map.Column("nr_date");
            });
            
            Property(x => x.Content, map =>
            {
                map.Length(800000);
                map.Column("nr_content");
            });

            Property(x => x.IsFJ, map =>
            {
                map.Column("has_fj");
            });

            Property(x => x.IsHot, map =>
            {
                map.Column("nr_is_hot");
            });

            Property(x => x.IsNew, map =>
            {
                map.Column("nr_is_new");
            });

            Property(x => x.IsShow, map =>
            {
                map.Column("nr_is_show");
            });

            Property(x => x.IsTop, map =>
            {
                map.Column("nr_is_top");
            });

            Property(x => x.Title, map =>
            {
                map.Length(500);
                map.Column("nr_title");
            });


            Property(x => x.BidContent, map =>
            {
                map.Length(40);
                map.Column("BidContent");
            });

            Property(x => x.BidType, map =>
            {
                map.Length(40);
                map.Column("BidType");
            });

            Property(x => x.ProjectCode, map =>
            {
                map.Length(40);
                map.Column("ProjectCode");
            });

            Property(x => x.ProjectName, map =>
            {
                map.Length(400);
                map.Column("ProjectName");
            });

            ManyToOne(x => x.Project, map =>
            {
                map.Column("proj_id");
            });

            ManyToOne(x => x.Type, map =>
            {
                map.Column("nr_type_id");
            });

            ManyToOne(x => x.User, map =>
            {
                map.Column("create_user_id");
            });

            ManyToOne(x => x.Type, map =>
            {
                map.Column("nr_type_id");
            });

            Table("nr_content");

            //不进行创建
            SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
